<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>盘点记录查询</title>

    <style>
        .t1 {
            width: 700px;
        }

        .t2 {
            width: 100px;
        }
    </style>

    <script src="http://localhost:10000/js/jquery-1.11.3.min.js"></script>
    <script src="http://localhost:10000/js/chaxun.js"></script>

</head>
<body>
<div style="border: solid 1px; background-color:aliceblue;  position: absolute;margin-left: 58px;margin-top:27px "
     id="d1" hidden></div>

<!-- 盘点记录查询 -->
<form action="/pandian/getlog.do" id="form1">
    <input type="hidden" name="pageNum"/>
    <input type="hidden" name="pageSize"/>

    <table border="1" cellspacing="0">

        <tr>
            <td>货主</td>
            <td>
                <input type="text" id="pandian1" th:value="${session.name}">
                <input type="hidden" name="custID" id="pandian3" th:value="${session.custID}"/>
            </td>
        </tr>

        <tr>
            <td>盘点日期</td>
            <td>
                <input type="date" name="date1" id="date1" th:value="${session.date1}"/>
                /
                <input type="date" name="date2" id="date2" th:value="${session.date2}"/>
            </td>
        </tr>

        <tr>
            <td>
                <input type="hidden" th:value="${session.size}"/>
            </td>
            <td><input type="submit" value="查询" id="chaxun"/></td>
        </tr>

    </table>
</form>
<br><br><br>

<table border="1" cellspacing="0" th:if="${session.pageInfochaxun != null}">
    <tr>
        <td class="t1" colspan="7">没有找到记录</td>
    </tr>


    <tr>
        <td>盘点记录编号</td>
        <td>货主</td>
        <td>盘点日期</td>
        <td>备注</td>
        <td>最后编辑时间</td>
        <td>是否删除</td>
    </tr>

    <tr th:each="every:${session.pageInfochaxun.list}">
        <!--        <td th:text="${every.chkrptID}"></td>-->
        <td th:text="${every.get('chkrptID')} == null ? 'null' : ${every.get('chkrptID')}"></td>
        <!--        <td th:text="${every.custName}"></td>-->
        <td th:text="${every.get('custName')} == null ? 'null' : ${every.get('custName')}"></td>
        <!--        <td th:text="${every.detailsEditTime}"></td>-->
        <td th:text="${every.get('detailsEditTime')} == null ? 'null' : ${every.get('detailsEditTime')}"></td>
        <td></td>
        <!--        <td th:text="${every.lasttime}"></td>-->
        <td th:text="${every.get('lasttime')} == null ? 'null' : ${every.get('lasttime')}"></td>
        <!--        <td th:text="${every.detailsIsDel}"></td>-->
        <td th:text="${every.get('detailsIsDel')} == null ? 'null' : ${every.get('detailsIsDel')}"></td>
    </tr>
    <!--    <tr>-->
    <!--        <td>一楼仓库</td>-->
    <!--        <td>张三丰</td>-->
    <!--        <td>1-01-00-00-0</td>-->
    <!--        <td>00020</td>-->
    <!--        <td>大白菜</td>-->
    <!--        <td>50</td>-->
    <!--    </tr>-->

    <input type="hidden" id="num" th:value="${session.num1}"/>
    <input type="hidden" id="size" th:value="${session.size1}"/>

    <tr>
        <button th:value="${session.pageInfochaxun.getPageNum()>1?session.pageInfochaxun.getPageNum()-1:session.pageInfochaxun.getPageNum()}"
                onclick="lastpage(this.value)">上一页
        </button>

        <select name="pageSize" id="pageSize" onchange="getpage1(this.value)">
            <option value="5" th:selected="${session.size1 == 5}">5</option>
            <option value="10" th:selected="${session.size1 == 10}">10</option>
            <option value="15" th:selected="${session.size1 == 15}">15</option>
        </select>

        <button th:value="${session.pageInfochaxun.getPageNum()<session.pageInfochaxun.getPages()?session.pageInfochaxun.getPageNum()+1:session.pageInfochaxun.getPageNum()}"
                onclick="lastpage(this.value)">下一页
        </button>
        <!--        <button th:value="${session.pageInfochaxun.getPageNum()<session.pageInfochaxun.getSize()?session.pageInfochaxun.getPageNum()+1:session.pageInfochaxun.getPageNum()}"-->
        <!--                onclick="lastpage(this.value)">下一页-->
        <!--        </button>-->
    </tr>
</table>


</body>
<script type="text/javascript">

    $("#pandian1").blur(function () {
        $("#pandian3").val("");
    })

    function getpage1(page) {

        var custID = $("#pandian3").val();
        var date1 = $("#date1").val();
        var date2 = $("#date2").val();
        var pageNum = $("#num").val();

        var size = $("#size").val();

        console.log(custID + '&' + date1 + '-' + date2 + '&' + pageNum + '&' + page);

        console.log('size为：' + size);

        window.location = "/pandian/getlog.do?custID=" + custID + "&date1=" + date1 + "&date2=" + date2 + "&pageNum=" + pageNum + "&pageSize=" + page;

    }


    function lastpage(page) {
        var custID = $("#pandian3").val();
        var pageSize = $("#pageSize").val();
        var date1 = $("#date1").val();
        var date2 = $("#date2").val();
        // window.alert(custID + ":" + date1 + ":" + date2 + ":" + page + ":" + pageSize);
        window.location = "/pandian/getlog.do?custID=" + custID + "&date1=" + date1 + "&date2=" + date2 + "&pageNum=" + page + "&pageSize=" + pageSize;
    }


</script>


</html>